<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 供应商申请详情</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>供应商提现申请信息</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form method="get" class="form-horizontal">
                        <input type="hidden" name="apply_id" value="{$info.apply_id}" />
                      
                            <div class="form-group">
                                <label class="col-sm-3 control-label">供应商名</label>
                                <div class="col-sm-9">
                                    <input readonly=""  class="form-control" type="text" value="{$info.supplier_name}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">供应商账户</label>
                                <div class="col-sm-9">
                                    <input readonly=""  class="form-control" type="text" value="{$info.username}">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">申请提现金额</label>
                                <div class="col-sm-9">
                                    <input readonly=""  class="form-control" type="text" value="￥{$info.apply_price}">
                                </div>
                            </div>

                             <div class="form-group">
                                <label class="col-sm-3 control-label">供应商余额</label>
                                <div class="col-sm-9">
                                    <input readonly=""  class="form-control" type="text" value="￥{$info.balance}">
                                </div>
                            </div>
                          

                            <div class="form-group">
                                <label class="col-sm-3 control-label">状  态：</label>
                                <div class="col-sm-9">
                                    <div class="form-control border-none">
                                    {if($info['apply_status'] == 1)} 
                                    <label for="statustrue">审核中</label>
                                    {elseif($info['apply_status'] == -1)}
                                    <label for="statustrue">审核未通过(原因：{$info['refuse_reason']})</label>
                                    {elseif($info['apply_status'] == 2)}
                                    <label for="statustrue">审核通过</label>
                                    {/if}
                                    </div>
                                </div>
                            </div>

                             <div class="form-group">
                                <label class="col-sm-3 control-label">审核人：</label>
                                <div class="col-sm-9">
                                    <div class="form-control border-none">
                                    <label for="statustrue">{$info['admin_text']}</label>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="hr-line-dashed"></div>
                            {if($info['apply_status'] == 1)}
                            <div class="form-group">
                                <div class="col-sm-5 col-sm-offset-3">
                                    <input type="button" class="btn btn-primary abt"  value="通过"  data-apply-status='2'>
                                    <input type="button" class="btn btn-danger abt" value="拒绝"   data-apply-status='-1'>
                                </div>
                            </div>
                           {/if} 

                           </form>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/content.min.js?v=1.0.0"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/jquery.validate.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/messages_zh.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/laydate/laydate.js"></script>
    <script src="{$Think.config.site.resource_url}js/jquery.imagePreview.1.0.js"></script>
</body>

</html>
<script>


$(document).ready(function(){
    layer.config({
       extend: 'extend/layer.ext.js'
    });

    $("img.preview").preview()    
    
    // $("input").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
     $('.abt').click(function(){
        var apply_status = $(this).data('apply-status');
        var apply_id = $("input[name='apply_id']").val();

        if (apply_status == -1) {
            // layer.msg('服务器错误！请稍后重试', {icon: 5});
            //例子2
            layer.prompt({
              formType: 2,
              title: '请填写拒绝理由',
                }, function(value, index, elem){
                  save(apply_id,apply_status,value);
            });
        }else if(apply_status == 2){
                  save(apply_id,apply_status);
        }
     })

    function save(apply_id,apply_status,refuse_reason=''){
    
        $.ajax({
            type : 'POST',
            url : '{:url("info")}',
            dataType : 'json',
            data : {apply_id:apply_id,apply_status:apply_status,refuse_reason:refuse_reason},
            success : function(result) {
                if(result.code >0) {
                    
                    window.parent.editSuccess(result);

                }  else  {
                    //修改失败
                    layer.msg(result.msg, {icon: 5});
                }
            },
            error : function(){
                layer.msg('服务器错误！请稍后重试', {icon: 5});
            }
        })

    };
})
</script>